//
//  ALDBManage.h
//  ios-loan-assistant
//
//  Created by hcs on 2018/9/11.
//  Copyright © 2018年 guoqingping. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "FMDatabase.h"
#import "ALDBManageMacro.h"

typedef NS_ENUM(NSInteger,HSDBManageType) {
    Default_DB_type,
    Cache_DB_type
};

@interface ALDBManage : NSObject
{
    NSString * _name;
    NSString *_default;
    NSString *_cache;
}

@property (nonatomic, readonly) FMDatabase * defatulBase;
@property (nonatomic, readonly) FMDatabase * cacheBase;
@property (nonatomic, assign) HSDBManageType dbType;
@property (nonatomic, assign) BOOL checkTable; //YES 需要检查  默认 NO
@property (nonatomic, readonly) FMDatabase * dataBase;  // 数据库操作对象

+ (ALDBManage *)standarDBManage;

+ (ALDBManage *)standarCacheDBManage;

//查询数据
- (FMResultSet*)selectWithSQLStr:(NSString*)sql;

// 插入数据
- (BOOL)insertWithSQLStr:(NSString*)sql;

// 修改数据
- (BOOL)updateWithSQLStr:(NSString*)sql;

// 删除数据
- (BOOL)deleteWithSQLStr:(NSString*)sql;

//删除数据库
- (BOOL)deleteSql;

//获取数据库路径
- (NSString *)getSqlNamePath;

- (int)reCreateTable:(NSString *)tableName;
@end
